package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.dto.OrdersPageQueryDTO;
import com.sky.entity.Orders;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface OrdersMapper {
    void save(Orders orders);

    Orders findOrderByNum(String orderNumber);

    //更新订单
    void updateById(Orders bulidOrders);

    Page<Orders> page(OrdersPageQueryDTO queryDTO);

    void findOrderByUserIdList(Long userId);

    /**
     * 修改派送状态为派送订单
     * @param id
     * @return
     */
    Orders findById(Long id);

    /**
     * 根据id取消订单
     * @param orders
     */
    void cancelOrders(Orders orders);

    /**
     * 根据id查询订单
     * @param id
     * @return
     */
    Orders findOrderById(Long id);

    /**
     * 把数据库订单状态改成已接单
     * @param orders
     */
    void updateByIdOrders(Orders orders);

    Orders findById(Integer id);

    List<Orders> findAll(@Param("status") Integer status,@Param("now") LocalDateTime now);

    Orders findOrderByUserIdAndNum(@Param("userId") Long userId, @Param("orderNumber") String orderNumber);
}
